// 桥接模式（Bridge）将抽象部分与它的实现部分分离，使它们都可以独立地变化。
class Color {
    constructor(name) {
        this.name = name;
    }
}

class Shape {
    constructor(name, color) {
        this.name = name;
        this.color = color;
    }
    draw() {
        console.log(`${this.color.name} ${this.name}`);
    }
}

function main() {
    let red = new Color("Red");
    let yellow = new Color("Yellow");
    let cicly = new Shape("Cicly", red);
    cicly.draw();
    let triangle = new Shape("triangle", yellow);
    triangle.draw();
}

main();
